package com.ningyue.water.enums;

/**
 * Created by steven on 16/1/10.
 */
public enum MeasureTypeEnums {
    PRESSURE(1, "pa"),
    PH(2, "");

    private int key;
    private String name;

    private MeasureTypeEnums(int key, String name) {
        this.key = key;
        this.name = name;
    }

    public int getKey() {
        return key;
    }

    public String getName() {
        return name;
    }

    public static MeasureTypeEnums getEnum(int key) {
        for(MeasureTypeEnums item : MeasureTypeEnums.values()) {
            if(item.key==key) {
                return item;
            }
        }
        return null;
    }

    public static String getName(int key) {
        MeasureTypeEnums item = getEnum(key);
        return item != null ? item.name : null;
    }


}
